package org.hq.web.sql.mapper;

import org.hq.web.sql.pojo.WebUser;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

import java.util.List;

import static org.junit.jupiter.api.Assertions.*;
@SpringBootTest
class UserMapperTest {
    @Autowired
    UserMapper user;
    @Test
    void insert() {
        user.insert(new WebUser());
    }

    @Test
    void testInsert() {
        //密码加密
        BCryptPasswordEncoder pe = new BCryptPasswordEncoder();
        String password = pe.encode("1813033378");

        //用户添加

        WebUser wuser = new WebUser("root", "何桥", password, "admin");
        int u =user.insert(wuser);
        System.out.println(u);
    }


    @Test
    void selectUserId() {
        WebUser root = user.selectUserId("root");
        System.out.println(root.toString());


    }
}